var DownLoadFile = function(options) {
    var config = $.extend(true, { method: 'post' }, options);
    var $iframe = $('<iframe id="down-file-iframe" />');
    var $form = $('<form target="down-file-iframe" method="' + config.method + '" />');
    $form.attr('action', config.url);
    for (var key in config.data) {
        $form.append('<input type="hidden" name="' + key + '" value="' + config.data[key] + '" />');
    }
    $iframe.append($form);
    $(document.body).append($iframe);
    $form[0].submit();
    $iframe.remove();
}

//格式化金额
function moneyFormat(cellValue) {
    if (cellValue == null || cellValue == '') {
        cellValue = 0;
    }
    cellValue = cellValue.toFixed(2);
    var total_p = "￥" + cellValue;

    return total_p;
}

//校验金额
function validateMoney(money) {
    var reg = /(^[1-9]([0-9]+)?(\.[0-9]{1,2})?$)|(^(0){1}$)|(^[0-9]\.[0-9]([0-9])?$)/;
    if (reg.test(money)) {
        return "Y";
    }
    return "请输入正确的金额,且最多两位小数!";
}

//layer关闭弹框
function closeModal() {
    var index = parent.layer.getFrameIndex(window.name);
    parent.layer.close(index);
}

//重载表格
function reloadTable() {
    $("#table_list").trigger("reloadGrid");
}


